import Vue from 'vue'
import '@/api'
import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import dayjs from 'dayjs'
Vue.prototype.dayjs = dayjs // 可以全局使用dayjs

//storage
import s from "@/utils/storage";
Vue.prototype.$s = s;

import mixin from "@/mixins/mixins.js";
Vue.mixin(mixin);

import Components from "./components";
Vue.use(Components);

import erd from "element-resize-detector";
Vue.prototype.$erd = erd()

import { VueJsonp } from 'vue-jsonp'
Vue.use(VueJsonp)

Vue.prototype.$img = ''

// 
import resetMessage from '@/utils/resetMessage';
Vue.prototype.$msg = resetMessage;

import * as filters from './filters' // global filters

Vue.use(Element, {
  size: Cookies.get('size') || 'medium', // set element-ui default size
})

// froala编辑器
import 'froala-editor/css/froala_editor.pkgd.min.css'
import 'froala-editor/css/froala_style.min.css'
import 'froala-editor/js/froala_editor.pkgd.min.js'
import 'froala-editor/js/languages/zh_cn.js'
import 'froala-editor/js/plugins.pkgd.min.js'
import VueFroala from 'vue-froala-wysiwyg'

Vue.use(VueFroala)

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
